

#pragma once

#include "zrxobject.h"
#include "zAdAChar.h"
#pragma pack (push, 8)

class UcRxMemberCollection;
class UcRxAttributeCollection;
class UcRxSet;
class UcRxImpClass;
class UcRxMemberCollectionBuilder;
typedef void (*UcRxMemberCollectionConstructorPtr)(UcRxMemberCollectionBuilder&, void*);


class UcRxClass: public UcRxObject
{
public:
    UCRX_DECLARE_MEMBERS(UcRxClass);

    UcRxObject* addX(UcRxClass*, UcRxObject*);
    UcRxObject* getX(const UcRxClass*);
    UcRxObject* delX(UcRxClass*);
    UcRxObject* queryX(const UcRxClass*);

    UcRxObject* create();
    const ZTCHAR* appName() const;
    const ZTCHAR* dxfName() const;
    const ZTCHAR* name() const;
    void        getClassVersion(int& dwgVer,
                    int& maintVer) const;
    int         proxyFlags() const;

    bool isDerivedFrom(const UcRxClass*) const;
    UcRxClass*     myParent() const;
    UcRx::Ordering comparedTo(const UcRxObject*) const;

    AppNameChangeFuncPtr appNameCallbackPtr() const;
protected:
	UcRxClass(const ZTCHAR*name, const ZTCHAR* parent, UcRxMemberCollectionConstructorPtr  memberConstruct, void* userData = NULL);
	virtual ~UcRxClass();
private:
	UcRxClass();
	friend class UcRxImpClass;
	UcRxImpClass* m_pImp;
};

UcRxClass* newUcRxClass(
    const ZTCHAR* className,
    const ZTCHAR* parentClassName,
    int         proxyFlags = 0,
    UcRxObject* (*pseudoConstructor)() = NULL,
    const ZTCHAR* dxfName = NULL,
    const ZTCHAR* appName = NULL);

UcRxClass* newUcRxClass(
    const ZTCHAR* className,
    const ZTCHAR* parentClassName,
    int         dwgVer,
    int         maintVer,
    int         proxyFlags = 0,
    UcRxObject* (*pseudoConstructor)() = NULL,
    const ZTCHAR* dxfName = NULL,
    const ZTCHAR* appName = NULL,
    AppNameChangeFuncPtr func = NULL);

UcRxClass* newUcRxClass(
	const ZTCHAR* className,
	const ZTCHAR* parentClassName,
	int         dwgVer,
	int         maintVer,
	int         proxyFlags ,
	UcRxObject* (*pseudoConstructor)() ,
	const ZTCHAR* dxfName ,
	const ZTCHAR* appName ,
	AppNameChangeFuncPtr func,
	UcRxMemberCollectionConstructorPtr makeMembers,
	void* userData = NULL);

void ucrxBuildClassHierarchy();

void deleteUcRxClass(UcRxClass* pClassObj);

inline bool UcRxObject::isKindOf(const UcRxClass* pOtherClass) const
{
    const UcRxClass * pMyClass = this->isA();
    return pMyClass == NULL ? false : pMyClass->isDerivedFrom(pOtherClass);
}

#pragma pack (pop)

